﻿<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Simple Blog</title>
        <meta name="description" content="Blite is a lightweight web blog application designed to be quick, easy to use and light on server resources. It's written in PHP and uses a SQLite database. Blite is available for free under a GPL licence.">
        <link rel="stylesheet" type="text/css" href="css/main.css">
        <link rel="stylesheet" type="text/css" href="css/header.css">
		<link rel="stylesheet" type="text/css" href="css/setting.css">

    </head>

    <body class="browse">
        <div class="display">
            <div class="header">

				<div class="rssicon">
					<a href="rss.php" title="Articles RSS Feed">
						<img src="images/rss.png" width="32" height="32" border="0" alt="Articles RSS Feed" id="a_rssicon">
					</a>
				</div>

				<h1 class="sitetitle"><a href="./" title="Simple Blog">Simple Blog</a></h1>

				<div class="tagline"> 
				  Administrator Setting
				</div>
			</div>

            <div class="settingDiv">
			<?php
				session_start();

				$didLogin = FALSE;

				if (!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
					header("location: login-form.php");
					exit();
				}
			?>
				<p style="text-align: center"> <lable id="error"></lable></p>
               <form id="settingForm" onsubmit="return validateForm();" action="setting-exec.php" method="post">				
					
					
					<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
					<tr>
						<td width="112"><b>Login name</b><span style="color:red">(*)</span></td>
						<td width="188"><input name="login" type="text" class="textfield" id="login"/></td>
					</tr>
					<tr>
						<td><b>Password</b><span style="color:red">(*)</span></td>
						<td><input name="passwd" type="password" class="textfield" id="passwd" /></td>
					</tr>					
					
					<tr>
						<td><b>Firstname</b><span style="color:red">(*)</span></td>
						<td><input name="firstname" type="text" class="textfield" id="firstname" /></td>
					</tr>
					<tr>
						<td><b>Lastname</b><span style="color:red">(*)</span></td>
						<td><input name="lastname" type="text" class="textfield" id="lastname" /></td>
					</tr>					
					
					<tr>
						<td>&nbsp;</td>
						<td><input type="submit" name="Submit" value="Save" /></td>
					</tr>
					</table>
			   </form>
			   <script type='text/javascript'>

					function validateForm(){
					
						// Make quick references to our fields
						var loginname = document.getElementById('login');
						var pw = document.getElementById('passwd');							
						var fn = document.getElementById('firstname');	
						var ln = document.getElementById('lastname');	
							
						// Check each input in the order that it appears in the form!
						if(isEmpty(loginname, "*Chưa nhập tên đăng nhập") || isEmpty(pw,"*Chưa nhập mật khẩu")  || isEmpty(pwa,"*Chưa nhập lại mật khẩu") || isEmpty(fn,"*Chưa nhập firstname") || isEmpty(ln,"*Chưa nhập lastname")){
							return false;
						}
						
						
						return true;
			
					}

					function isEmpty(elem, helperMsg){
						if(elem.value.length == 0){
							var errorLable = document.getElementById('error');
							errorLable.innerHTML = helperMsg;
							errorLable.style.fontWeight = "Bold";
							errorLable.style.color = "Red";
							errorLable.style.fontFamily="arial,sans-serif";
							errorLable.style.fontSize = "10px";
					
							//alert(helperMsg);
							elem.focus(); // set the focus to this input
							return true;
						}
						return false;
					}

				</script>

            </div>
				
                
		</div>
		
    </body>
</html>